Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JitArm64_SystemRegisters: Small FixGTBeforeSettingCRFieldBit optimization #13267

Merged
merged 1 commit into from
Jan 28, 2025

Conversation

Sintendo
Copy link
Member

@Sintendo Sintendo commented Jan 6, 2025

The computed value is only used when the register is equal to zero, so we can fully precompute it and materialize the constant instead. In other words, we change from

return reg == 0 ? (reg | 1ULL << 63) : reg;

to

return reg == 0 ? 1ULL << 63 : reg;

The number of instructions remains the same, but we eliminate an unnecessary dependency on the register value.

Before:

0xb241037a   orr    x26, x27, #0x8000000000000000
0xeb1f037f   cmp    x27, xzr
0x9a9a137b   csel   x27, x27, x26, ne

After:

0xd2f0001a   mov    x26, #-0x8000000000000000 ; =-9223372036854775808
0xeb1f037f   cmp    x27, xzr
0x9a9a137b   csel   x27, x27, x26, ne

…tion

The computed value is only used when the register is equal to zero, so
we can fully precompute it and materialize the constant instead. In
other words, we change from

```
return reg == 0 ? (reg | 1ULL << 63) : reg;
```

to

```
return reg == 0 ? 1ULL << 63 : reg;
```

The number of instructions remains the same, but we eliminate an
unnecessary dependency on the register value.

Before:
0xb241037a   orr    x26, x27, #0x8000000000000000
0xeb1f037f   cmp    x27, xzr
0x9a9a137b   csel   x27, x27, x26, ne

After:
0xd2f0001a   mov    x26, #-0x8000000000000000 ; =-9223372036854775808
0xeb1f037f   cmp    x27, xzr
0x9a9a137b   csel   x27, x27, x26, ne
@AdmiralCurtiss AdmiralCurtiss merged commit 3f79aa2 into dolphin-emu:master Jan 28, 2025
13 checks passed
@Sintendo Sintendo deleted the arm64-fix-gt-micro branch January 28, 2025 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants